package com.lex.crossgate.admin.common.job.service.impl;

import com.lex.crossgate.admin.common.job.dao.QuartzJobLogManager;
import com.lex.crossgate.admin.common.job.entity.QuartzJobEntity;
import com.lex.crossgate.admin.common.job.entity.QuartzJobLogEntity;
import com.lex.crossgate.admin.common.job.service.QuartzJobLogService;
import com.lex.crossgate.common.constants.R;;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 定时任务日志
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2017年8月21日 上午11:18:22
 */
@Service("quartzJobLogService")
public class QuartzJobLogServiceImpl implements QuartzJobLogService {

	@Autowired
	private QuartzJobLogManager quartzJobLogManager;
	
	@Override
	public List<QuartzJobLogEntity> listForPage(String beanName) {
		/*Query query = new Query(params);
		Page<QuartzJobLogEntity> page = new Page<>(query);
		quartzJobLogManager.listForPage(page, query);
		return page;*/
		EntityWrapper entityWrapper = new EntityWrapper();
		entityWrapper.eq("bean_name",beanName);
		List<QuartzJobLogEntity> jobList = quartzJobLogManager.selectList(entityWrapper);

		return jobList;
	}

	@Override
	public R batchRemove(String[] ids) {
		int count = quartzJobLogManager.deleteBatchIds(Arrays.asList(ids));
		return null;
	}

	@Override
	public R batchRemoveAll() {
		int count = quartzJobLogManager.delete(null);
		return null;
	}


}
